package com.szf.task.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.szf.base.service.BaseService;
import com.szf.task.entity.AppInfo;
import com.szf.util.StringUtil;

@Service
public class AppService extends BaseService {
	public AppInfo findByKey(String appKey) {
		List<AppInfo> list = super.hibernateDao.findBy(AppInfo.class, "appKey", appKey);
		if (list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

	public AppInfo findById(String appId) {
		return super.hibernateDao.get(AppInfo.class, appId);
	}

	public void save(AppInfo appInfo) {
		super.hibernateDao.saveOrUpdate(appInfo);
	}

	public void deleteApp(String ids) {
		if (StringUtil.isEmpty(ids)) {
			return;
		}
		String inIds = StringUtil.getInString(ids);
		Map<String, String> param = new HashMap<String, String>();
		param.put("ids", inIds);
		super.ibatisDao.delete("sinlog.deleteApp", param);
	}

}
